//
//  CCMyLayer.m
//  newFinding
//
//  Created by Shin Stupid on 7/26/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CCMyLayer.h"

@implementation CCMyLayer
#pragma mark -------------------------------Over Write--------------------------------------------
-(void)initBackground
{
        // fuction for over write
}
#pragma mark ----------------------------------------------------------------------------
#pragma mark ADD_SPRITES
-(CCSprite*)DrawImageSpritebyLayer:(CCLayer*)myLayer andFileName:(NSString *)strName atPosition:(CGPoint)P withZ:(int)iZ andScale:(float)fScale AnchorPoint:(CGPoint)pAnchor
{
	CCSprite *item =[CCSprite spriteWithFile:strName];
	[item setAnchorPoint:pAnchor];
	[item setPosition:P];	
	if(fScale>0)
	{
		[item setScale:fScale];
	}
    
	if(iZ!=0)
	{
		[myLayer addChild:item z:iZ];
		
	}
	else {
		[myLayer addChild:item];
		
	}
    
	return item;
}
-(void)changePageWithScene:(CCScene *)changeScene type:(CHANGE_SCENE_TYPE_ANIMATION)N
{
	switch (N) {
		case SlideInLeft:
			/// slide right
			[[CCDirector sharedDirector] replaceScene:[SlideInLeftAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case SlideInRight:
			/// slide left			
			[[CCDirector sharedDirector] replaceScene:[SlideInRightAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case FadeUp:
			/// fade up 
			[[CCDirector sharedDirector] replaceScene:[FadeUpAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case FadeDown:
			/// fade Down 
			[[CCDirector sharedDirector] replaceScene:[FadeDownAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case PageTurn:
			/// Page Turn
			[[CCDirector sharedDirector] replaceScene:[PageTurnAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case FlipX:
			/// Flip X
			[[CCDirector sharedDirector] replaceScene:[FlipXAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case FlipY:
			/// Flip Y
			[[CCDirector sharedDirector] replaceScene:[FlipYAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case ShrinkGrow:
			/// Shrink Grow
			[[CCDirector sharedDirector] replaceScene:[ShrinkGrowAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case CrossFade:
			//CrossFade
			[[CCDirector sharedDirector] replaceScene:[CrossFadeAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
//		case 10:
//			//RadialCCW
//			//[[CCDirector sharedDirector] replaceScene:[RadialCCWAnimation transitionWithDuration:1.0f scene:changeScene]];
//			break;
		case TurnOffTiles:
			//TurnOffTiles
			[[CCDirector sharedDirector] replaceScene:[TurnOffTilesAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case ZoomFlipAngular:
			//ZoomFlipAngular
			[[CCDirector sharedDirector] replaceScene:[ZoomFlipAngularAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case ZoomFlipX:
			//ZoomFlipX
			[[CCDirector sharedDirector] replaceScene:[ZoomFlipXAnimation transitionWithDuration:1.0f scene:changeScene]];
			break;
		case ZoomFlipY:
			//ZoomFlipY
			[[CCDirector sharedDirector] replaceScene:[ZoomFlipYAnimation transitionWithDuration:1.0f scene:changeScene]];
			
			break;
		case NONE_ANIMATION:
			//Normal
			[[CCDirector sharedDirector] replaceScene:changeScene];
			
			break;
			
		default:
			break;
	}
}
#pragma mark ----------------------------------------------------------------------------
#pragma mark ----------------------------------------------------------------------------
-(CCFiniteTimeAction *) getActionSequence: (NSMutableArray *) actions
{
	CCFiniteTimeAction *seq = nil;
	for (CCFiniteTimeAction *anAction in actions)
	{
		if (!seq)
		{
			seq = anAction;
		}
		else
		{
			seq = [CCSequence actionOne:seq two:anAction];
		}
	}
	return seq ;
	
}
-(AnimationClass*)addImageAnimationByClass:(Class)tempClass withZ:(int)iZ
{
	AnimationClass* _itemClass=[[[tempClass alloc] initWithParent:self withZ:iZ] autorelease];
	
	return _itemClass;
}

@end
